﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace NJL.Web.Controls
{
    public partial class WUCHeaderShop : BaseUserControl
    {
        private readonly BLL.NJL_COMPANY bllCompany = new BLL.NJL_COMPANY();
        protected Model.NJL_COMPANY modelCompany;

        protected string companyId;
        protected IList<Model.NJL_CS_AREA> listArea;

        protected string FROM_URL = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                modelCompany = bllCompany.GetModel(Request.QueryString["id"]);
            }
            else
            {
                Response.Redirect("/", true);
            }

            listArea = new BLL.NJL_CS_AREA().GetModelList(" AREA_CODE like '" + WEBSITE_CODE.Substring(0, 2) + "%' and deep=2 ");
            if (UserId != "")
            {
                Model.NJL_COMPANY modelCompany1 = bllCompany.GetCompanyByUserIDModel(UserId);
                if (modelCompany1 != null)
                {
                    companyId = modelCompany1.ID;
                }
            }

            if (Request.QueryString["url"] != null && Request.QueryString["url"] != "")
            {
                FROM_URL = Server.UrlEncode(Server.UrlDecode(Request.QueryString["url"]));
            }
            else
            {
                FROM_URL = Server.UrlEncode(Request.RawUrl);
            }
        }
    }
}